package algorithm.hash;

/**
 * <p>
 * 类注释
 * </p>
 *
 * @author liyi
 * @since 2024/4/19 14:15
 */
public class HashTest {
    private static int hash(Object key) {
        int capicity = 1024 * 1024 * 1024 * 4;
        int h = key.hashCode();
        return (h ^ (h >>> 16)) & (capicity - 1); //capicity表示散列表的大小,最好使用2的整数倍
    }

    public static void main(String[] args) {
        Object o1 = "o11qs";
        Object o2 = "o2enk";
        System.out.println(hash(o1));
        System.out.println(hash(o2));
    }

}
